/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package busquedaProfundidad;

import java.util.ArrayList;
import java.util.List;

/**
 * Esta clase permite obtener los estados sucesores de un estado dado
 */
public class Sucesor {
    public List<Nodo> hijos;  //Lista de hijos del nodo padre
    public Nodo estadoPadre; //variable que almacena el nodo padre
    public Sucesor (Nodo padre){
        hijos = new ArrayList();
        estadoPadre = padre;
    }
//Metodo que determina los movimientos posibles del caballo negro segun su ubicacion
private ArrayList movimientos(int x, int y){
        //ESTE METODO DEVUELVE LOS MOVIMIENTOS POSIBLES A EFECTUAR
        //POR CADA POSICION DEL CABALLO NEGRO SEGUN SU UBICACION
        ArrayList movs = new ArrayList();

        if((x==0)&&(y==0)){
            //cantidad de movimientos posibles: 2
            int[] mov1;
            mov1 = new int[2];
            mov1[0]=1; //fila
            mov1[1]=2; //columna
            int[]mov2;
            mov2 = new int[2];
            mov2[0]=2;
            mov2[1]=1;
            movs.add(mov1);
            movs.add(mov2);
        }
        //falta hacer por cada posicion del tablero

        if((x==0)&&(y==1)){
            int []mov1;
            int []mov2;
            int []mov3;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];

            mov1[0] = 2;
            mov1[1] = 0;

            mov2[0] = 2;
            mov2[1] = 2;

            mov3[0] = 1;
            mov3[1] = 3;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
        }

        if((x==0)&&(y==2)){
            int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];

            mov1[0] = 1;
            mov1[1] = 0;

            mov2[0] = 2;
            mov2[1] = 1;

            mov3[0] = 2;
            mov3[1] = 3;

            mov4[0] = 1;
            mov4[1] = 4;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);

        }

        if((x==0)&&(y==3)){
            int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];

            mov1[0] = 1;
            mov1[1] = 1;

            mov2[0] = 2;
            mov2[1] = 2;

            mov3[0] = 2;
            mov3[1] = 4;

            mov4[0] = 1;
            mov4[1] = 5;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
        }

        if((x==0)&&(y==4)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];

            mov1[0] = 1;
            mov1[1] = 2;

            mov2[0] = 2;
            mov2[1] = 3;

            mov3[0] = 2;
            mov3[1] = 5;

            mov4[0] = 1;
            mov4[1] = 6;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
        }

        if((x==0)&&(y==5)){
         int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];

            mov1[0] = 1;
            mov1[1] = 3;

            mov2[0] = 2;
            mov2[1] = 4;

            mov3[0] = 2;
            mov3[1] = 6;

            mov4[0] = 1;
            mov4[1] = 7;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
        }

        if((x==0)&&(y==6)){
        int []mov1;
            int []mov2;
            int []mov3;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];

            mov1[0] = 1;
            mov1[1] = 4;

            mov2[0] = 2;
            mov2[1] = 5;

            mov3[0] = 2;
            mov3[1] = 7;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
        }

        if((x==0)&&(y==7)){
            int []mov1;
            int []mov2;

            mov1 = new int[2];
            mov2 = new int[2];


            mov1[0] = 1;
            mov1[1] = 5;

            mov2[0] = 2;
            mov2[1] = 6;

            movs.add(mov1);
            movs.add(mov2);

        }

        if((x==1)&&(y==0)){
            int []mov1;
            int []mov2;
            int []mov3;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];

            mov1[0] = 0;
            mov1[1] = 2;

            mov2[0] = 2;
            mov2[1] = 2;

            mov3[0] = 3;
            mov3[1] = 1;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
        }

        if((x==1)&&(y==1)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];

            mov1[0] = 3;
            mov1[1] = 0;

            mov2[0] = 3;
            mov2[1] = 2;

            mov3[0] = 0;
            mov3[1] = 3;

            mov4[0] = 2;
            mov4[1] = 3;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
        }

        if((x==1)&&(y==2)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int []mov5;
            int []mov6;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];

            mov1[0] = 0;
            mov1[1] = 0;

            mov2[0] = 2;
            mov2[1] = 0;

            mov3[0] = 3;
            mov3[1] = 1;

            mov4[0] = 3;
            mov4[1] = 3;

            mov5[0] = 2;
            mov5[1] = 4;

            mov6[0] = 0;
            mov6[1] = 4;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
        }

        if((x==1)&&(y==3)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int []mov5;
            int []mov6;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];

            mov1[0] = 0;
            mov1[1] = 1;

            mov2[0] = 2;
            mov2[1] = 1;

            mov3[0] = 3;
            mov3[1] = 2;

            mov4[0] = 3;
            mov4[1] = 4;

            mov5[0] = 2;
            mov5[1] = 5;

            mov6[0] = 0;
            mov6[1] = 5;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
        }

        if((x==1)&&(y==4)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int []mov5;
            int []mov6;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];

            mov1[0] = 0;
            mov1[1] = 2;

            mov2[0] = 2;
            mov2[1] = 2;

            mov3[0] = 3;
            mov3[1] = 3;

            mov4[0] = 3;
            mov4[1] = 5;

            mov5[0] = 2;
            mov5[1] = 6;

            mov6[0] = 0;
            mov6[1] = 6;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
        }

        if((x==1)&&(y==5)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int []mov5;
            int []mov6;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];

            mov1[0] = 0;
            mov1[1] = 3;

            mov2[0] = 2;
            mov2[1] = 3;

            mov3[0] = 3;
            mov3[1] = 4;

            mov4[0] = 3;
            mov4[1] = 6;

            mov5[0] = 2;
            mov5[1] = 7;

            mov6[0] = 0;
            mov6[1] = 7;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
        }

        if((x==1)&&(y==6)){
            int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];

            mov1[0] = 0;
            mov1[1] = 4;

            mov2[0] = 2;
            mov2[1] = 4;

            mov3[0] = 3;
            mov3[1] = 5;

            mov4[0] = 3;
            mov4[1] = 7;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);

        }

        if((x==1)&&(y==7)){
        int []mov1;
            int []mov2;
            int []mov3;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];

            mov1[0] = 0;
            mov1[1] = 5;

            mov2[0] = 2;
            mov2[1] = 5;

            mov3[0] = 3;
            mov3[1] = 6;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);


        }

        if((x==2)&&(y==0)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];

            mov1[0] = 0;
            mov1[1] = 1;

            mov2[0] = 1;
            mov2[1] = 2;

            mov3[0] = 3;
            mov3[1] = 2;

            mov4[0] = 4;
            mov4[1] = 1;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
        }

        if((x==2)&&(y==1)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int []mov5;
            int []mov6;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];

            mov1[0] = 0;
            mov1[1] = 0;

            mov2[0] = 0;
            mov2[1] = 2;

            mov3[0] = 1;
            mov3[1] = 3;

            mov4[0] = 3;
            mov4[1] = 3;

            mov5[0] = 4;
            mov5[1] = 0;

            mov6[0] = 4;
            mov6[1] = 2;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
        }

        if((x==2)&&(y==2)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int []mov5;
            int []mov6;
            int []mov7;
            int []mov8;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];
            mov7 = new int[2];
            mov8 = new int[2];

            mov1[0] = 0;
            mov1[1] = 1;

            mov2[0] = 1;
            mov2[1] = 0;

            mov3[0] = 3;
            mov3[1] = 0;

            mov4[0] = 4;
            mov4[1] = 1;

            mov5[0] = 0;
            mov5[1] = 3;

            mov6[0] = 1;
            mov6[1] = 4;

            mov7[0] = 3;
            mov7[1] = 4;

            mov8[0] = 4;
            mov8[1] = 3;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
            movs.add(mov7);
            movs.add(mov8);
        }

        if((x==2)&&(y==3)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int []mov5;
            int []mov6;
            int []mov7;
            int []mov8;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];
            mov7 = new int[2];
            mov8 = new int[2];

            mov1[0] = 0;
            mov1[1] = 2;

            mov2[0] = 1;
            mov2[1] = 1;

            mov3[0] = 3;
            mov3[1] = 1;

            mov4[0] = 4;
            mov4[1] = 2;

            mov5[0] = 0;
            mov5[1] = 4;

            mov6[0] = 1;
            mov6[1] = 5;

            mov7[0] = 3;
            mov7[1] = 5;

            mov8[0] = 4;
            mov8[1] = 4;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
            movs.add(mov7);
            movs.add(mov8);
        }

        if((x==2)&&(y==4)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int []mov5;
            int []mov6;
            int []mov7;
            int []mov8;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];
            mov7 = new int[2];
            mov8 = new int[2];

            mov1[0] = 0;
            mov1[1] = 3;

            mov2[0] = 1;
            mov2[1] = 2;

            mov3[0] = 3;
            mov3[1] = 2;

            mov4[0] = 4;
            mov4[1] = 3;

            mov5[0] = 0;
            mov5[1] = 5;

            mov6[0] = 1;
            mov6[1] = 6;

            mov7[0] = 3;
            mov7[1] = 6;

            mov8[0] = 4;
            mov8[1] = 5;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
            movs.add(mov7);
            movs.add(mov8);
        }

        if((x==2)&&(y==5)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int []mov5;
            int []mov6;
            int []mov7;
            int []mov8;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];
            mov7 = new int[2];
            mov8 = new int[2];

            mov1[0] = 0;
            mov1[1] = 4;

            mov2[0] = 1;
            mov2[1] = 3;

            mov3[0] = 3;
            mov3[1] = 3;

            mov4[0] = 4;
            mov4[1] = 4;

            mov5[0] = 0;
            mov5[1] = 6;

            mov6[0] = 1;
            mov6[1] = 7;

            mov7[0] = 3;
            mov7[1] = 7;

            mov8[0] = 4;
            mov8[1] = 6;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
            movs.add(mov7);
            movs.add(mov8);
        }

        if((x==2)&&(y==6)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int []mov5;
            int []mov6;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];

            mov1[0] = 0;
            mov1[1] = 5;

            mov2[0] = 1;
            mov2[1] = 4;

            mov3[0] = 3;
            mov3[1] = 4;

            mov4[0] = 4;
            mov4[1] = 5;

            mov5[0] = 0;
            mov5[1] = 7;

            mov6[0] = 4;
            mov6[1] = 7;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
        }

        if((x==2)&&(y==7)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];

            mov1[0] = 0;
            mov1[1] = 6;

            mov2[0] = 1;
            mov2[1] = 5;

            mov3[0] = 3;
            mov3[1] = 5;

            mov4[0] = 4;
            mov4[1] = 6;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);

        }

        if((x==3)&&(y==0)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];

            mov1[0] = 1;
            mov1[1] = 1;

            mov2[0] = 2;
            mov2[1] = 2;

            mov3[0] = 4;
            mov3[1] = 2;

            mov4[0] = 5;
            mov4[1] = 1;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
        }

        if((x==3)&&(y==1)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int []mov5;
            int []mov6;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];

            mov1[0] = 1;
            mov1[1] = 0;

            mov2[0] = 1;
            mov2[1] = 2;

            mov3[0] = 2;
            mov3[1] = 3;

            mov4[0] = 4;
            mov4[1] = 3;

            mov5[0] = 5;
            mov5[1] = 0;

            mov6[0] = 5;
            mov6[1] = 2;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
        }

        if((x==3)&&(y==2)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int []mov5;
            int []mov6;
            int []mov7;
            int []mov8;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];
            mov7 = new int[2];
            mov8 = new int[2];

            mov1[0] = 2;
            mov1[1] = 0;

            mov2[0] = 1;
            mov2[1] = 1;

            mov3[0] = 1;
            mov3[1] = 3;

            mov4[0] = 2;
            mov4[1] = 4;

            mov5[0] = 4;
            mov5[1] = 0;

            mov6[0] = 5;
            mov6[1] = 1;

            mov7[0] = 4;
            mov7[1] = 4;

            mov8[0] = 5;
            mov8[1] = 3;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
            movs.add(mov7);
            movs.add(mov8);
        }

        if((x==3)&&(y==3)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int []mov5;
            int []mov6;
            int []mov7;
            int []mov8;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];
            mov7 = new int[2];
            mov8 = new int[2];

            mov1[0] = 1;
            mov1[1] = 2;

            mov2[0] = 2;
            mov2[1] = 1;

            mov3[0] = 4;
            mov3[1] = 1;

            mov4[0] = 5;
            mov4[1] = 2;

            mov5[0] = 5;
            mov5[1] = 4;

            mov6[0] = 1;
            mov6[1] = 4;

            mov7[0] = 2;
            mov7[1] = 5;

            mov8[0] = 4;
            mov8[1] = 5;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
            movs.add(mov7);
            movs.add(mov8);
        }

        if((x==3)&&(y==4)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int []mov5;
            int []mov6;
            int []mov7;
            int []mov8;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];
            mov7 = new int[2];
            mov8 = new int[2];

            mov1[0] = 1;
            mov1[1] = 3;

            mov2[0] = 2;
            mov2[1] = 2;

            mov3[0] = 4;
            mov3[1] = 2;

            mov4[0] = 5;
            mov4[1] = 3;

            mov5[0] = 1;
            mov5[1] = 5;

            mov6[0] = 2;
            mov6[1] = 6;

            mov7[0] = 4;
            mov7[1] = 6;

            mov8[0] = 5;
            mov8[1] = 5;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
            movs.add(mov7);
            movs.add(mov8);
        }

        if((x==3)&&(y==5)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int []mov5;
            int []mov6;
            int []mov7;
            int []mov8;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];
            mov7 = new int[2];
            mov8 = new int[2];

            mov1[0] = 1;
            mov1[1] = 4;

            mov2[0] = 2;
            mov2[1] = 3;

            mov3[0] = 4;
            mov3[1] = 3;

            mov4[0] = 5;
            mov4[1] = 4;

            mov5[0] = 1;
            mov5[1] = 6;

            mov6[0] = 2;
            mov6[1] = 7;

            mov7[0] = 4;
            mov7[1] = 7;

            mov8[0] = 5;
            mov8[1] = 6;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
            movs.add(mov7);
            movs.add(mov8);
        }

        if((x==3)&&(y==6)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int []mov5;
            int []mov6;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];

            mov1[0] = 1;
            mov1[1] = 5;

            mov2[0] = 2;
            mov2[1] = 4;

            mov3[0] = 4;
            mov3[1] = 4;

            mov4[0] = 1;
            mov4[1] = 7;

            mov5[0] = 5;
            mov5[1] = 5;

            mov6[0] = 5;
            mov6[1] = 7;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
        }

        if((x==3)&&(y==7)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];

            mov1[0] = 1;
            mov1[1] = 6;

            mov2[0] = 2;
            mov2[1] = 5;

            mov3[0] = 4;
            mov3[1] = 5;

            mov4[0] = 5;
            mov4[1] = 6;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);

        }

        if((x==4)&&(y==0)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];

            mov1[0] = 2;
            mov1[1] = 1;

            mov2[0] = 3;
            mov2[1] = 2;

            mov3[0] = 5;
            mov3[1] = 2;

            mov4[0] = 6;
            mov4[1] = 1;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
        }

        if((x==4)&&(y==1)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int[]mov5;
            int []mov6;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];

            mov1[0] = 2;
            mov1[1] = 0;

            mov2[0] = 2;
            mov2[1] = 2;

            mov3[0] = 3;
            mov3[1] = 3;

            mov4[0] = 5;
            mov4[1] = 3;

            mov5[0] = 6;
            mov5[1] = 0;

            mov6[0] = 6;
            mov6[1] = 2;


            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
        }

        if((x==4)&&(y==2)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int []mov5;
            int []mov6;
            int []mov7;
            int []mov8;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];
            mov7 = new int[2];
            mov8 = new int[2];

            mov1[0] = 2;
            mov1[1] = 1;

            mov2[0] = 3;
            mov2[1] = 0;

            mov3[0] = 5;
            mov3[1] = 0;

            mov4[0] = 6;
            mov4[1] = 1;

            mov5[0] = 2;
            mov5[1] = 3;

            mov6[0] = 3;
            mov6[1] = 4;

            mov7[0] = 5;
            mov7[1] = 4;

            mov8[0] = 6;
            mov8[1] = 3;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
            movs.add(mov7);
            movs.add(mov8);
        }

        if((x==4)&&(y==3)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int []mov5;
            int []mov6;
            int []mov7;
            int []mov8;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];
            mov7 = new int[2];
            mov8 = new int[2];

            mov1[0] = 2;
            mov1[1] = 2;

            mov2[0] = 3;
            mov2[1] = 1;

            mov3[0] = 5;
            mov3[1] = 1;

            mov4[0] = 6;
            mov4[1] = 2;

            mov5[0] = 2;
            mov5[1] = 4;

            mov6[0] = 3;
            mov6[1] = 5;

            mov7[0] = 5;
            mov7[1] = 5;

            mov8[0] = 6;
            mov8[1] = 4;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
            movs.add(mov7);
            movs.add(mov8);
        }

        if((x==4)&&(y==4)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int []mov5;
            int []mov6;
            int []mov7;
            int []mov8;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];
            mov7 = new int[2];
            mov8 = new int[2];

            mov1[0] = 2;
            mov1[1] = 3;

            mov2[0] = 3;
            mov2[1] = 2;

            mov3[0] = 5;
            mov3[1] = 2;

            mov4[0] = 6;
            mov4[1] = 3;

            mov5[0] = 2;
            mov5[1] = 5;

            mov6[0] = 3;
            mov6[1] = 6;

            mov7[0] = 5;
            mov7[1] = 6;

            mov8[0] = 6;
            mov8[1] = 5;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
            movs.add(mov7);
            movs.add(mov8);
        }

        if((x==4)&&(y==5)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int []mov5;
            int []mov6;
            int []mov7;
            int []mov8;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];
            mov7 = new int[2];
            mov8 = new int[2];

            mov1[0] = 2;
            mov1[1] = 4;

            mov2[0] = 3;
            mov2[1] = 3;

            mov3[0] = 5;
            mov3[1] = 3;

            mov4[0] = 6;
            mov4[1] = 4;

            mov5[0] = 2;
            mov5[1] = 6;

            mov6[0] = 3;
            mov6[1] = 7;

            mov7[0] = 5;
            mov7[1] = 7;

            mov8[0] = 6;
            mov8[1] = 6;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
            movs.add(mov7);
            movs.add(mov8);
        }

        if((x==4)&&(y==6)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int[]mov5;
            int []mov6;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];

            mov1[0] = 2;
            mov1[1] = 5;

            mov2[0] = 3;
            mov2[1] = 4;

            mov3[0] = 5;
            mov3[1] = 4;

            mov4[0] = 6;
            mov4[1] = 5;

            mov5[0] = 2;
            mov5[1] = 7;

            mov6[0] = 6;
            mov6[1] = 7;


            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
        }

        if((x==4)&&(y==7)){
            int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];

            mov1[0] = 2;
            mov1[1] = 6;

            mov2[0] = 3;
            mov2[1] = 5;

            mov3[0] = 5;
            mov3[1] = 5;

            mov4[0] = 6;
            mov4[1] = 6;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);

        }

        if((x==5)&&(y==0)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];

            mov1[0] = 3;
            mov1[1] = 1;

            mov2[0] = 4;
            mov2[1] = 2;

            mov3[0] = 6;
            mov3[1] = 2;

            mov4[0] = 7;
            mov4[1] = 1;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
        }

        if((x==5)&&(y==1)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int[]mov5;
            int []mov6;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];

            mov1[0] = 3;
            mov1[1] = 0;

            mov2[0] = 3;
            mov2[1] = 2;

            mov3[0] = 4;
            mov3[1] = 3;

            mov4[0] = 6;
            mov4[1] = 3;

            mov5[0] = 7;
            mov5[1] = 0;

            mov6[0] = 7;
            mov6[1] = 2;


            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
        }

        if((x==5)&&(y==2)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int []mov5;
            int []mov6;
            int []mov7;
            int []mov8;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];
            mov7 = new int[2];
            mov8 = new int[2];

            mov1[0] = 4;
            mov1[1] = 0;

            mov2[0] = 3;
            mov2[1] = 1;

            mov3[0] = 3;
            mov3[1] = 3;

            mov4[0] = 4;
            mov4[1] = 4;

            mov5[0] = 6;
            mov5[1] = 4;

            mov6[0] = 7;
            mov6[1] = 3;

            mov7[0] = 7;
            mov7[1] = 1;

            mov8[0] = 6;
            mov8[1] = 0;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
            movs.add(mov7);
            movs.add(mov8);
        }

        if((x==5)&&(y==3)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int []mov5;
            int []mov6;
            int []mov7;
            int []mov8;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];
            mov7 = new int[2];
            mov8 = new int[2];

            mov1[0] = 4;
            mov1[1] = 1;

            mov2[0] = 3;
            mov2[1] = 2;

            mov3[0] = 4;
            mov3[1] = 3;

            mov4[0] = 4;
            mov4[1] = 5;

            mov5[0] = 6;
            mov5[1] = 5;

            mov6[0] = 7;
            mov6[1] = 4;

            mov7[0] = 7;
            mov7[1] = 2;

            mov8[0] = 6;
            mov8[1] = 1;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
            movs.add(mov7);
            movs.add(mov8);
        }
        if((x==5)&&(y==4)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int []mov5;
            int []mov6;
            int []mov7;
            int []mov8;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];
            mov7 = new int[2];
            mov8 = new int[2];

            mov1[0] = 4;
            mov1[1] = 2;

            mov2[0] = 3;
            mov2[1] = 3;

            mov3[0] = 3;
            mov3[1] = 5;

            mov4[0] = 4;
            mov4[1] = 6;

            mov5[0] = 6;
            mov5[1] = 6;

            mov6[0] = 7;
            mov6[1] = 5;

            mov7[0] = 7;
            mov7[1] = 3;

            mov8[0] = 6;
            mov8[1] = 2;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
            movs.add(mov7);
            movs.add(mov8);
        }

        if((x==5)&&(y==5)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int []mov5;
            int []mov6;
            int []mov7;
            int []mov8;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];
            mov7 = new int[2];
            mov8 = new int[2];

            mov1[0] = 4;
            mov1[1] = 3;

            mov2[0] = 3;
            mov2[1] = 4;

            mov3[0] = 3;
            mov3[1] = 6;

            mov4[0] = 4;
            mov4[1] = 7;

            mov5[0] = 6;
            mov5[1] = 7;

            mov6[0] = 7;
            mov6[1] = 6;

            mov7[0] = 7;
            mov7[1] = 4;

            mov8[0] = 6;
            mov8[1] = 3;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
            movs.add(mov7);
            movs.add(mov8);
        }

        if((x==5)&&(y==6)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int[]mov5;
            int []mov6;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];

            mov1[0] = 4;
            mov1[1] = 4;

            mov2[0] = 3;
            mov2[1] = 5;

            mov3[0] = 3;
            mov3[1] = 7;

            mov4[0] = 6;
            mov4[1] = 4;

            mov5[0] = 7;
            mov5[1] = 5;

            mov6[0] = 7;
            mov6[1] = 7;


            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
        }

        if((x==5)&&(y==7)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];

            mov1[0] = 3;
            mov1[1] = 6;

            mov2[0] = 4;
            mov2[1] = 5;

            mov3[0] = 7;
            mov3[1] = 6;

            mov4[0] = 6;
            mov4[1] = 5;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);

        }

        if((x==6)&&(y==0)){
            int []mov1;
            int []mov2;
            int []mov3;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];

            mov1[0] = 4;
            mov1[1] = 1;

            mov2[0] = 5;
            mov2[1] = 2;

            mov3[0] = 7;
            mov3[1] = 2;


            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);

        }

        if((x==6)&&(y==1)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];

            mov1[0] = 4;
            mov1[1] = 0;

            mov2[0] = 4;
            mov2[1] = 2;

            mov3[0] = 5;
            mov3[1] = 3;

            mov4[0] = 7;
            mov4[1] = 3;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
        }

        if((x==6)&&(y==2)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int[]mov5;
            int []mov6;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];

            mov1[0] = 5;
            mov1[1] = 0;

            mov2[0] = 4;
            mov2[1] = 1;

            mov3[0] = 4;
            mov3[1] = 3;

            mov4[0] = 5;
            mov4[1] = 4;

            mov5[0] = 7;
            mov5[1] = 0;

            mov6[0] = 7;
            mov6[1] = 4;


            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
        }

        if((x==6)&&(y==3)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int[]mov5;
            int []mov6;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];

            mov1[0] = 5;
            mov1[1] = 1;

            mov2[0] = 4;
            mov2[1] = 2;

            mov3[0] = 4;
            mov3[1] = 4;

            mov4[0] = 5;
            mov4[1] = 5;

            mov5[0] = 7;
            mov5[1] = 1;

            mov6[0] = 7;
            mov6[1] = 5;


            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
        }

        if((x==6)&&(y==4)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int[]mov5;
            int []mov6;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];

            mov1[0] = 5;
            mov1[1] = 2;

            mov2[0] = 4;
            mov2[1] = 3;

            mov3[0] = 4;
            mov3[1] = 5;

            mov4[0] = 5;
            mov4[1] = 6;

            mov5[0] = 7;
            mov5[1] = 6;

            mov6[0] = 7;
            mov6[1] = 2;


            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
        }

        if((x==6)&&(y==5)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int[]mov5;
            int []mov6;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];

            mov1[0] = 5;
            mov1[1] = 3;

            mov2[0] = 4;
            mov2[1] = 4;

            mov3[0] = 4;
            mov3[1] = 6;

            mov4[0] = 5;
            mov4[1] = 7;

            mov5[0] = 7;
            mov5[1] = 3;

            mov6[0] = 7;
            mov6[1] = 7;


            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
        }

        if((x==6)&&(y==6)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];

            mov1[0] = 4;
            mov1[1] = 5;

            mov2[0] = 4;
            mov2[1] = 7;

            mov3[0] = 5;
            mov3[1] = 4;

            mov4[0] = 7;
            mov4[1] = 4;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
        }

        if((x==6)&&(y==7)){
        int []mov1;
            int []mov2;
            int []mov3;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];

            mov1[0] = 4;
            mov1[1] = 6;

            mov2[0] = 5;
            mov2[1] = 5;

            mov3[0] = 7;
            mov3[1] = 5;


            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);

        }

        if((x==7)&&(y==0)){
            int []mov1;
            int []mov2;

            mov1 = new int[2];
            mov2 = new int[2];

            mov1[0] = 5;
            mov1[1] = 1;

            mov2[0] = 6;
            mov2[1] = 2;

            movs.add(mov1);
            movs.add(mov2);

        }

        if((x==7)&&(y==1)){
        int []mov1;
            int []mov2;
            int []mov3;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];

            mov1[0] = 5;
            mov1[1] = 0;

            mov2[0] = 5;
            mov2[1] = 2;

            mov3[0] = 6;
            mov3[1] = 3;


            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
        }

        if((x==7)&&(y==2)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];

            mov1[0] = 6;
            mov1[1] = 0;

            mov2[0] = 5;
            mov2[1] = 1;

            mov3[0] = 5;
            mov3[1] = 3;

            mov4[0] = 6;
            mov4[1] = 4;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
        }

        if((x==7)&&(y==3)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];

            mov1[0] = 6;
            mov1[1] = 1;

            mov2[0] = 5;
            mov2[1] = 2;

            mov3[0] = 5;
            mov3[1] = 4;

            mov4[0] = 6;
            mov4[1] = 5;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
        }

        if((x==7)&&(y==4)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];

            mov1[0] = 6;
            mov1[1] = 2;

            mov2[0] = 5;
            mov2[1] = 3;

            mov3[0] = 5;
            mov3[1] = 5;

            mov4[0] = 6;
            mov4[1] = 6;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
        }

        if((x==7)&&(y==5)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];

            mov1[0] = 6;
            mov1[1] = 3;

            mov2[0] = 5;
            mov2[1] = 4;

            mov3[0] = 5;
            mov3[1] = 6;

            mov4[0] = 6;
            mov4[1] = 7;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
        }

        if((x==7)&&(y==6)){
        int []mov1;
            int []mov2;
            int []mov3;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];

            mov1[0] = 5;
            mov1[1] = 5;

            mov2[0] = 5;
            mov2[1] = 7;

            mov3[0] = 6;
            mov3[1] = 4;


            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);

        }

        if((x==7)&&(y==7)){
        int []mov1;
            int []mov2;


            mov1 = new int[2];
            mov2 = new int[2];


            mov1[0] = 5;
            mov1[1] = 6;

            mov2[0] = 6;
            mov2[1] = 5;

            movs.add(mov1);
            movs.add(mov2);
        }
        return movs;
    }

//Metodo para obtener los hijos, que llama a aplicar regla
public int obtenerHijo(int numRegla){
        int filaCn = 0;
        int colCn = 0;
        filaCn = this.getEstadoPadre().filaCN();
        colCn = this.getEstadoPadre().colCN();
        int nuevaFila = 0;
        int nuevaCol = 0;
        int retornaRegla = 0;      
        if(numRegla==1){
        nuevaFila = filaCn + 1;
        nuevaCol = colCn + 2;
        boolean regla1 = false;
        regla1 = this.aplicarReglas(nuevaFila, nuevaCol);
        if(regla1){
            retornaRegla = 1;
        }else{
            numRegla = numRegla + 1;
            retornaRegla = this.obtenerHijo(numRegla);
            numRegla = 0;
        }
             
     }
     if(numRegla==2){
      //ver si podemos aplicar la regla 2
      boolean regla2 = false;
      nuevaFila = filaCn + 2;
      nuevaCol = colCn - 1;
      regla2 = this.aplicarReglas(nuevaFila, nuevaCol);
      if(regla2){
            retornaRegla = 2;
        }else{
            numRegla = numRegla + 1;
            retornaRegla = this.obtenerHijo(numRegla);
            numRegla = 0;
        }
      }

        if(numRegla==3){
        //ver si podemos aplicar la regla 3
        boolean regla3 = false;
        nuevaFila = filaCn - 1;
        nuevaCol = colCn - 2;
        regla3 = this.aplicarReglas(nuevaFila, nuevaCol);
        if(regla3){
            retornaRegla = 3;
        }else{
            numRegla = numRegla + 1;
            retornaRegla = this.obtenerHijo(numRegla);
            numRegla = 0;
            }
         }

        if(numRegla==4){
        //ver si podemos aplicar regla 4
        boolean regla4 = false;
        nuevaFila = filaCn - 2;
        nuevaCol = colCn + 1;
        regla4 = this.aplicarReglas(nuevaFila, nuevaCol);
        if(regla4){
            retornaRegla = 4;
        }else{
            numRegla = numRegla + 1;
            retornaRegla = this.obtenerHijo(numRegla);
            numRegla = 0;
        }
        }

        if(numRegla==5){
        //ver si podemos aplicar regla 5
        boolean regla5 = false;
        nuevaFila = filaCn - 1;
        nuevaCol = colCn + 2;
        regla5 = this.aplicarReglas(nuevaFila, nuevaCol);
        if(regla5){
            retornaRegla = 5;
        }else{
            numRegla = numRegla + 1;
            retornaRegla = this.obtenerHijo(numRegla);
            numRegla = 0;
        }
        }

        if(numRegla==6){
        //ver si podemos aplicar regla 6
        boolean regla6 = false;
        nuevaFila = filaCn + 2;
        nuevaCol = colCn + 1;
        regla6 = this.aplicarReglas(nuevaFila, nuevaCol);
        if(regla6){
            retornaRegla = 6;
        }else{
            numRegla = numRegla + 1;
            retornaRegla = this.obtenerHijo(numRegla);
            numRegla = 0;
        }
        }

        if(numRegla==7){
        boolean regla7 = false;
        nuevaFila = filaCn + 1;
        nuevaCol = colCn - 2;
        regla7 = this.aplicarReglas(nuevaFila, nuevaCol);
        if(regla7){
            retornaRegla = 7;
        }else{
            numRegla = numRegla + 1;
            retornaRegla = this.obtenerHijo(numRegla);
            numRegla = 0;
        }
        }
        if(numRegla==8){
        boolean regla8 = false;
        nuevaFila = filaCn - 2;
        nuevaCol = colCn - 1;
        regla8 = this.aplicarReglas(nuevaFila, nuevaCol);
        retornaRegla = 8;
        numRegla = 0;
        }
                                                       
        return retornaRegla;
    }

    //Metodo que hace efectiva la aplicacion de la regla dada
    //devuelve true si la pudo aplicar, false en caso contrario
public boolean aplicarReglas(int nuevaFila, int nuevaCol){
    boolean encontro = false;
    List <int []> movimiento;
    movimiento = new ArrayList();
    movimiento = this.movimientos(this.getEstadoPadre().filaCN(), this.getEstadoPadre().colCN());
        //obtuvimos todos los movimientos posibles
        // comparar con las reglas de movimiento
    for(int i = 0; i<movimiento.size(); i++){
            int [] aux;
            aux = movimiento.get(i);
            if((aux[0] == nuevaFila)&&(aux[1]==nuevaCol)){
                encontro = true;
                // se puede aplicar el operador de movimiento
            }
        }
        if(encontro){
            //aplica la primer regla que puede
            Nodo hijo = new Nodo(this.getEstadoPadre().getPosicion());
            hijo.modificarPosicion(this.getEstadoPadre().filaCN(), this.getEstadoPadre().colCN(), 0);
            hijo.modificarPosicion(nuevaFila, nuevaCol, 2);
            int [][] posAnterior;
            posAnterior = this.getEstadoPadre().getPosicion();
            if(posAnterior[nuevaFila][nuevaCol] == 1){
               
                hijo.calcularCostoNuevo(this.getEstadoPadre().getCosto(), 10);
                hijo.modificarPeso(nuevaFila, nuevaCol, 20);

            }else{
                 
                hijo.calcularCostoNuevo(this.getEstadoPadre().getCosto(), 20);
                System.out.println(this.estadoPadre.getAcum20());
                hijo.setAcum20(this.estadoPadre.getAcum20());
                hijo.acumular();
                hijo.modificarPeso(nuevaFila, nuevaCol, 20);
                
            }
            this.getHijos().add(hijo);

        }
        return encontro;

    }
    //Metodo que imprime en consola los hijos obtenidos
public void mostrarHijos(){

    for(int i=0;i<this.getHijos().size();i++){
            Nodo unHijo;
            unHijo = this.getHijos().get(i);
            int [][] elHijo;
            elHijo = unHijo.getPosicion();
            System.out.println("Hijo Nº"+i);
            System.out.println("Valores de su matriz de posicion");
            for(int j=0;j<8;j++){
                for(int k=0;k<8;k++){

                    System.out.print(elHijo[j][k]);
                }
                System.out.println();
            }

            System.out.println("Valores de su matriz de pesos");
            int [][] pesos;
            pesos = unHijo.getPeso();
            for(int p=0;p<8;p++){
                for(int m=0;m<8;m++){
                    System.out.print(pesos[p][m]);
                }
                System.out.println();
            }

            System.out.println("Costo: "+unHijo.getCosto());
            System.out.println("acum20: "+unHijo.getAcum20());

}


}

    //Getters y Setters
    public List<Nodo> getHijos() {
        return hijos;
    }

    /**
     * @param hijos the hijos to set
     */
    public void setHijos(List<Nodo> hijos) {
        this.hijos = hijos;
    }

    /**
     * @return the estadoPadre
     */
    public Nodo getEstadoPadre() {
        return estadoPadre;
    }

    /**
     * @param estadoPadre the estadoPadre to set
     */
    public void setEstadoPadre(Nodo estadoPadre) {
        this.estadoPadre = estadoPadre;
    }


}
